package com.soft.javase.day08.listremoverepeat;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/27
 */
public class StringRemoveRepeat {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("apple");
        list.add("banana");
        list.add("apple");
        list.add("orange");
        list.add("banana");
        System.out.println("去重前："+list);

        List<String> changeList = new ArrayList<>();
        for (String item : list) {
            if (!changeList.contains(item)) {
                changeList.add(item);
            }
        }

        System.out.println("去重后: " + changeList);
    }
}
